<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<title>二货GO—商品详情</title>

<!-- 导入控制显示的css -->
<link rel="stylesheet" href="css/commodityDetail.css">
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/custom/commodityDetail.js"></script>
<script type="text/javascript">
	var commId="${memComm.commo.id}"; //商品ID
	var memId="${memComm.member.id}"; //发布者ID
	var commQuality="${memComm.commo.quality }"; //成色
	var commentNum="${memComm.commo.commendNum }"; //点赞数
	var reportNum="${memComm.commo.reportNum }"; //举报次数
	var memberId="${sessionScope.existUser.id}"; //用户ID
	$(function(){
		$("#commendPointer").html("点赞（"+commentNum+"）");
	});
</script>
</head>
<body>
	<jsp:include page="frame.jsp"></jsp:include>
	<div class="commodityInfo">
		<!-- <div class="personInfo">
			
		</div> -->
		<div class="allImgs">
			<div class="bigImgs">
				<img src="${memComm.commo.headimgUrl }">
			</div>
			<div class="smallImgs">
				<div class="smallImg" id="imgMain">
					<img src="${memComm.commo.headimgUrl }">
				</div>
			</div>
			<script type="text/javascript">
				var imgList="${memComm.commo.imgUrlList }";
				var imgs=imgList.split(",");
				for(var i=0; i<imgs.length; i++){
					$(".smallImgs").append("<div class='smallImg'><img src='"+imgs[i]+"'></div>");
				}
			</script>
		</div>
		<div class="detailInfo">
			<h1 class="title">${memComm.commo.name }</h1>
			<div class="price">
				出&nbsp;售&nbsp;价：<span class="span2">
					<b>￥</b> <em>${memComm.commo.transferPrice }</em>
				</span>
			</div>
			<div class="price priceCommon">
				原&nbsp;&nbsp;价：<span class="span2">
					<b style="font-size: 16px;">￥</b> <em class="originalPrice"
					style="color: #444; font-size: 16px; font-weight: 100; text-decoration: line-through;">${memComm.commo.oriPrice }</em>
				</span>
			</div>
			<div class="otherInfo">
				<div class="infoCommon">
					成&nbsp;色：<span class="span1" id="commQuality"></span>
				</div>
				<div class="infoCommon">
					所&nbsp;在&nbsp;地：<span class="span1">${memComm.commo.location }</span>
				</div>
				<div class="infoCommon">
					发&nbsp;布&nbsp;者：<span class="span1">${memComm.member.nickName }</span>
				</div>
				<div class="infoCommon">
					最新编辑时间：<span class="span1">${memComm.commo.editTime }</span>
				</div>
				<div class="buy">立即购买</div>
				<button id="commendPointer"></button>
				<button id="reportPointer">举报（${memComm.commo.reportNum }）</button>
				<button id="collectPointer">收藏</button>
			</div>
		</div>
		<script type="text/javascript">
			var count=0;
			$("#commendPointer").click(function(){
				if(count==0){
					commentNum++;
					$(this).html("点赞（"+commentNum+"）");
					count++;
					$.ajax({
						url:"commodityInfo_clickCommend?commodityInfo.id="+commId,
						type:"get",
					})
				}else{
					return;
				}
			});
			$("#collectPointer").click(function(){
				if(!memberId){
					alert("请先登录。");
					return;
				}
				if($(this).html()=="收藏"){				
					$.ajax({
						url:"commodityInfo_judgeCollect?commId="+commId+"&memberId="+memberId,
						type:"get",
						success:function(data){
							if(data.message=="收藏成功！"){								
								$("#collectPointer").html("取消收藏");
							}
							alert(data.message);	
						}
					})
				}else{
					$.ajax({
						url:"commodityInfo_cancelCollect?commId="+commId+"&memberId="+memberId,
						type:"get",
						success:function(data){
							if(data.message=="取消收藏成功！"){								
								$("#collectPointer").html("收藏");
							}
							alert(data.message);
						}
					})
				}
			});
		</script>
		<div class="commodityMessage">
			<div>
				<a class="intro" href="javascript:void(0);">宝贝介绍</a>
			</div>
			<div>
				<a class="message" href="javascript:void(0);">留言</a>
			</div>
			<div>
				<a class="safe" href="javascript:void(0);">安全保障</a>
			</div>
		</div>
		<div class="commodityMessageDetail">
			<div class="introDetail commodityMessageCommon"
				style="display: block;">
				<p style="font-size: 12px; font-family: '宋体'; margin-top: 15px;">如遇到以下情况可能是诈骗行为：1.宝贝价格异常低；2.卖家要求QQ沟通；3.卖家要求直接汇款。
					寻求防骗经验。</p>
				<div class="goodsIntro">
					<span class="spanCommon">宝贝介绍</span>
					<div class="goodsIntroDetails">
						<p>${memComm.commo.detail }</p>
					</div>
				</div>
			</div>
			<div class="messageDetail commodityMessageCommon">
				<p style="font-size: 12px; font-family: '宋体'; margin-top: 15px;">如遇到以下情况可能是诈骗行为：1.宝贝价格异常低；2.卖家要求QQ沟通；3.卖家要求直接汇款。
					寻求防骗经验。</p>
				<span class="spanCommon">留言</span>
				<div class="allMessages">
					<div class="messageOne">
						<div class="personImg">
							<img src="img/goods/goods102.jpg" alt="" />
						</div>
						<div class="replyInfo">
							<p class="name">
								<span class="username">生*沫</span> <span class="msgContent">
									回复@时***欺:???</span>
							</p>
							<p class="time">2017-02-14 18:17:14</p>
						</div>
					</div>
					<div class="messageOne">
						<div class="personImg">
							<img src="img/goods/goods102.jpg" alt="" />
						</div>
						<div class="replyInfo">
							<p class="name">
								<span class="username">生*沫</span> <span class="msgContent">
									这是啥，这么贵。</span>
							</p>
							<p class="time">2017-02-14 18:17:14</p>
						</div>
					</div>
					<div class="messageOne">
						<div class="personImg">
							<img src="img/goods/goods102.jpg" alt="" />
						</div>
						<div class="replyInfo">
							<p class="name">
								<span class="username">生*沫</span> <span class="msgContent">
									这是啥，这么贵。</span>
							</p>
							<p class="time">2017-02-14 18:17:14</p>
						</div>
					</div>
				</div>
				<div class="page" style="clear: both; width:380px;margin:20px auto;">
					第1/10页 <a href="">首页</a> <a href="">上一页</a> 
					<a href="">下一页</a> <a href="">尾页</a> 第<input
						type="text" size="3" name="num" id="num" value="" />页 <a
						href="javascript:void(0)" onclick="">跳转</a>
				</div>
			</div>
			<div class="safeDetail commodityMessageCommon">
				<p style="font-size: 12px; font-family: '宋体'; margin-top: 15px;">如遇到以下情况可能是诈骗行为：1.宝贝价格异常低；2.卖家要求QQ沟通；3.卖家要求直接汇款。
					寻求防骗经验。</p>
			</div>
		</div>
	</div>
	<jsp:include page="foot.jsp" />
</body>
</html>